package com.netty.esc.common.enums;

/**
 * @ClassName: 11094
 * @Description:
 * @Author: zy
 * @Date: 2022/12/11 14:36
 **/
public enum MessageTypeEnum {

    MESSAGE("001", "文字"),
    PICTURE("002", "图片"),
    FILE("003", "文件"),
    VOICE("004", "音频"),
    ;

    private final String desc;
    private final String code;

    MessageTypeEnum(String code, String desc) {
        this.desc = desc;
        this.code = code;
    }

    public String desc() {
        return desc;
    }

    public String code() {
        return code;
    }

    /*
     * 匹配操作码
     * */
    public static WSProtocolTypeEM matchType(String code) {
        for (WSProtocolTypeEM protocolType : WSProtocolTypeEM.values()) {
            if (protocolType.code().equals(code)) {
                return protocolType;
            }
        }
        return WSProtocolTypeEM.UNKNOWN;
    }
}
